package com.junglone.gateway.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

@Controller
public class WebFluxTestController {

    private static final String HELLO = "/system/hello";

    @RequestMapping("/")
    public String hello(Model model) {
        // 数组
        Flux<String> flux = Flux.just("hello flux");
        // 实例
        Mono<String> mono = Mono.just("hello mono");

        // 无效设置
        model.addAttribute("hello", "hello attribute");

        model.addAttribute("flux", flux);
        model.addAttribute("mono", mono);
        return HELLO;
    }

}
